package com.bnyy.medicalHousekeeper.moudle.health.fragment;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bnyy.health.bean.BloodPressureWeekly;
import com.bnyy.medicalHousekeeper.R;
import com.bnyy.medicalHousekeeper.base.BaseFragmentImpl;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Author : 关炳鹏
 * Description :
 * Date : 2022/8/26
 **/
public class WaitForWeeklyFragment extends BaseFragmentImpl {

    @BindView(R.id.tv_result)
    TextView tvResult;
    @BindView(R.id.tv_tips)
    TextView tvTips;
    @BindView(R.id.tv_confirm)
    TextView tvConfirm;
    private Callback callback;

    public static WaitForWeeklyFragment getInstance(BloodPressureWeekly.Tips tips) {
        WaitForWeeklyFragment fragment = new WaitForWeeklyFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("tips", tips);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_wait_for_weekly;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        BloodPressureWeekly.Tips tips = (BloodPressureWeekly.Tips) getArguments().getSerializable("tips");

        tvResult.setText(tips.getB_phrase());
        tvTips.setText(tips.getGrey_phrase());
    }

    @Override
    public void onAttach(@NonNull Context context) {
        super.onAttach(context);
        if (context instanceof Callback) {
            callback = (Callback) context;
        }
    }

    @OnClick(R.id.tv_confirm)
    public void onViewClicked() {
        callback.onConfirm();
    }

    public interface Callback {
        void onConfirm();
    }
}




























